package com.project.class8_17;

import java.util.Arrays;

public class TestMyObj {
    public static void main(String[] args) {
        Class objClass = MyObj.class;
        //判断指定类中，是否存在MyAnnotation注解
        if(objClass.isAnnotationPresent(MyAnnotation.class)){
            //得到指定类中，MyAnnotation注解对象
            MyAnnotation my= (MyAnnotation)objClass.getAnnotation(MyAnnotation.class);
            //得到注解元素的值
            String name = my.name();
            int age = my.age();
            int[] array = my.array();
            System.out.println(name+"   "+age+"   "+ Arrays.toString(array));
        }
    }
}
